.class public Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;
.super Ljava/lang/Object;
.source "CustomHttpURLConnection.java"


# static fields
.field private static TAG:Ljava/lang/String;

.field private static conn:Ljava/net/HttpURLConnection;


# direct methods
.method static constructor <clinit>()V
    .registers 1

    .prologue
    .line 16
    const-string v0, "CustomHttpUrlConnection"

    sput-object v0, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->TAG:Ljava/lang/String;

    return-void
.end method

.method public constructor <init>()V
    .registers 1

    .prologue
    .line 19
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 20
    return-void
.end method

.method public static varargs GetFromWebByHttpUrlConnection(Ljava/lang/String;[Lorg/apache/http/NameValuePair;)Ljava/lang/String;
    .registers 13
    .param p0, "strUrl"    # Ljava/lang/String;
    .param p1, "nameValuePairs"    # [Lorg/apache/http/NameValuePair;

    .prologue
    const/4 v8, 0x0

    .line 24
    const-string v3, ""

    .line 26
    .local v3, "result":Ljava/lang/String;
    :try_start_3
    new-instance v6, Ljava/net/URL;

    invoke-direct {v6, p0}, Ljava/net/URL;-><init>(Ljava/lang/String;)V

    .line 28
    .local v6, "url":Ljava/net/URL;
    invoke-virtual {v6}, Ljava/net/URL;->openConnection()Ljava/net/URLConnection;

    move-result-object v7

    check-cast v7, Ljava/net/HttpURLConnection;

    sput-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->conn:Ljava/net/HttpURLConnection;

    .line 29
    sget-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->conn:Ljava/net/HttpURLConnection;

    const/4 v9, 0x1

    invoke-virtual {v7, v9}, Ljava/net/HttpURLConnection;->setDoInput(Z)V

    .line 30
    sget-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->conn:Ljava/net/HttpURLConnection;

    const/16 v9, 0xbb8

    invoke-virtual {v7, v9}, Ljava/net/HttpURLConnection;->setConnectTimeout(I)V

    .line 31
    sget-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->conn:Ljava/net/HttpURLConnection;

    const/16 v9, 0xfa0

    invoke-virtual {v7, v9}, Ljava/net/HttpURLConnection;->setReadTimeout(I)V

    .line 32
    sget-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->conn:Ljava/net/HttpURLConnection;

    const-string v9, "accept"

    const-string v10, "*/*"

    invoke-virtual {v7, v9, v10}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V

    .line 34
    sget-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->conn:Ljava/net/HttpURLConnection;

    invoke-virtual {v7}, Ljava/net/HttpURLConnection;->connect()V

    .line 35
    sget-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->conn:Ljava/net/HttpURLConnection;

    invoke-virtual {v7}, Ljava/net/HttpURLConnection;->getInputStream()Ljava/io/InputStream;

    move-result-object v5

    .line 36
    .local v5, "stream":Ljava/io/InputStream;
    new-instance v2, Ljava/io/InputStreamReader;

    invoke-direct {v2, v5}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;)V

    .line 37
    .local v2, "inReader":Ljava/io/InputStreamReader;
    new-instance v0, Ljava/io/BufferedReader;

    invoke-direct {v0, v2}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V

    .line 38
    .local v0, "buffer":Ljava/io/BufferedReader;
    const/4 v4, 0x0

    .line 39
    .local v4, "strLine":Ljava/lang/String;
    :goto_43
    invoke-virtual {v0}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;

    move-result-object v4

    if-eqz v4, :cond_5b

    .line 41
    new-instance v7, Ljava/lang/StringBuilder;

    invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v7, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    goto :goto_43

    .line 43
    :cond_5b
    invoke-virtual {v2}, Ljava/io/InputStreamReader;->close()V

    .line 44
    sget-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->conn:Ljava/net/HttpURLConnection;

    invoke-virtual {v7}, Ljava/net/HttpURLConnection;->disconnect()V
    :try_end_63
    .catch Ljava/net/MalformedURLException; {:try_start_3 .. :try_end_63} :catch_65
    .catch Ljava/io/IOException; {:try_start_3 .. :try_end_63} :catch_87

    move-object v7, v3

    .line 55
    .end local v0    # "buffer":Ljava/io/BufferedReader;
    .end local v2    # "inReader":Ljava/io/InputStreamReader;
    .end local v4    # "strLine":Ljava/lang/String;
    .end local v5    # "stream":Ljava/io/InputStream;
    .end local v6    # "url":Ljava/net/URL;
    :goto_64
    return-object v7

    .line 46
    :catch_65
    move-exception v1

    .line 48
    .local v1, "e":Ljava/net/MalformedURLException;
    sget-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->TAG:Ljava/lang/String;

    new-instance v9, Ljava/lang/StringBuilder;

    invoke-direct {v9}, Ljava/lang/StringBuilder;-><init>()V

    const-string v10, "getFromWebByHttpUrlCOnnection:"

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v1}, Ljava/net/MalformedURLException;->getMessage()Ljava/lang/String;

    move-result-object v10

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v9}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v9

    invoke-static {v7, v9}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 49
    invoke-virtual {v1}, Ljava/net/MalformedURLException;->printStackTrace()V

    move-object v7, v8

    .line 50
    goto :goto_64

    .line 51
    .end local v1    # "e":Ljava/net/MalformedURLException;
    :catch_87
    move-exception v1

    .line 53
    .local v1, "e":Ljava/io/IOException;
    sget-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->TAG:Ljava/lang/String;

    new-instance v9, Ljava/lang/StringBuilder;

    invoke-direct {v9}, Ljava/lang/StringBuilder;-><init>()V

    const-string v10, "getFromWebByHttpUrlCOnnection:"

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v1}, Ljava/io/IOException;->getMessage()Ljava/lang/String;

    move-result-object v10

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v9}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v9

    invoke-static {v7, v9}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 54
    invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V

    move-object v7, v8

    .line 55
    goto :goto_64
.end method

.method public static varargs PostFromWebByHttpURLConnection(Ljava/lang/String;[Lorg/apache/http/NameValuePair;)Ljava/lang/String;
    .registers 12
    .param p0, "strUrl"    # Ljava/lang/String;
    .param p1, "nameValuePairs"    # [Lorg/apache/http/NameValuePair;

    .prologue
    .line 61
    const-string v4, ""

    .line 63
    .local v4, "result":Ljava/lang/String;
    :try_start_2
    new-instance v6, Ljava/net/URL;

    invoke-direct {v6, p0}, Ljava/net/URL;-><init>(Ljava/lang/String;)V

    .line 65
    .local v6, "url":Ljava/net/URL;
    invoke-virtual {v6}, Ljava/net/URL;->openConnection()Ljava/net/URLConnection;

    move-result-object v7

    check-cast v7, Ljava/net/HttpURLConnection;

    sput-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->conn:Ljava/net/HttpURLConnection;

    .line 67
    sget-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->conn:Ljava/net/HttpURLConnection;

    const/4 v8, 0x1

    invoke-virtual {v7, v8}, Ljava/net/HttpURLConnection;->setDoInput(Z)V

    .line 70
    sget-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->conn:Ljava/net/HttpURLConnection;

    const/4 v8, 0x1

    invoke-virtual {v7, v8}, Ljava/net/HttpURLConnection;->setDoOutput(Z)V

    .line 72
    sget-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->conn:Ljava/net/HttpURLConnection;

    const-string v8, "POST"

    invoke-virtual {v7, v8}, Ljava/net/HttpURLConnection;->setRequestMethod(Ljava/lang/String;)V

    .line 74
    sget-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->conn:Ljava/net/HttpURLConnection;

    const/16 v8, 0xbb8

    invoke-virtual {v7, v8}, Ljava/net/HttpURLConnection;->setConnectTimeout(I)V

    .line 75
    sget-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->conn:Ljava/net/HttpURLConnection;

    const/16 v8, 0xfa0

    invoke-virtual {v7, v8}, Ljava/net/HttpURLConnection;->setReadTimeout(I)V

    .line 77
    sget-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->conn:Ljava/net/HttpURLConnection;

    const/4 v8, 0x0

    invoke-virtual {v7, v8}, Ljava/net/HttpURLConnection;->setUseCaches(Z)V

    .line 78
    sget-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->conn:Ljava/net/HttpURLConnection;

    const/4 v8, 0x1

    invoke-virtual {v7, v8}, Ljava/net/HttpURLConnection;->setInstanceFollowRedirects(Z)V

    .line 81
    sget-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->conn:Ljava/net/HttpURLConnection;

    const-string v8, "Content-Type"

    const-string v9, "application/x-www-form-urlencoded"

    invoke-virtual {v7, v8, v9}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V

    .line 86
    sget-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->conn:Ljava/net/HttpURLConnection;

    invoke-virtual {v7}, Ljava/net/HttpURLConnection;->getInputStream()Ljava/io/InputStream;

    move-result-object v2

    .line 87
    .local v2, "in":Ljava/io/InputStream;
    new-instance v3, Ljava/io/InputStreamReader;

    invoke-direct {v3, v2}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;)V

    .line 88
    .local v3, "inStream":Ljava/io/InputStreamReader;
    new-instance v0, Ljava/io/BufferedReader;

    invoke-direct {v0, v3}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V

    .line 89
    .local v0, "buffer":Ljava/io/BufferedReader;
    const/4 v5, 0x0

    .line 90
    .local v5, "strLine":Ljava/lang/String;
    :goto_56
    invoke-virtual {v0}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;

    move-result-object v5

    if-eqz v5, :cond_6e

    .line 92
    new-instance v7, Ljava/lang/StringBuilder;

    invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v7, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
    :try_end_6c
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_6c} :catch_70

    move-result-object v4

    goto :goto_56

    :cond_6e
    move-object v7, v4

    .line 98
    .end local v0    # "buffer":Ljava/io/BufferedReader;
    .end local v2    # "in":Ljava/io/InputStream;
    .end local v3    # "inStream":Ljava/io/InputStreamReader;
    .end local v5    # "strLine":Ljava/lang/String;
    .end local v6    # "url":Ljava/net/URL;
    :goto_6f
    return-object v7

    .line 95
    :catch_70
    move-exception v1

    .line 96
    .local v1, "ex":Ljava/io/IOException;
    sget-object v7, Lcom/zuiapps/suite/utils/http/CustomHttpURLConnection;->TAG:Ljava/lang/String;

    new-instance v8, Ljava/lang/StringBuilder;

    invoke-direct {v8}, Ljava/lang/StringBuilder;-><init>()V

    const-string v9, "PostFromWebByHttpURLConnection\uff1a"

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v1}, Ljava/io/IOException;->getMessage()Ljava/lang/String;

    move-result-object v9

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v8

    invoke-static {v7, v8}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 97
    invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V

    .line 98
    const/4 v7, 0x0

    goto :goto_6f
.end method
